<?php 
define('VERSION', "0.0.1");
define('SEPARATOR', "/");

session_start();

$user_email = (isset($_POST['user_email']) ? $_POST['user_email'] : '');
//echo 'user_email='.$user_email;
if ($user_email!='') {
	if (($user_email=="x") || ($user_email=="admin"))  {
		$_SESSION['usuario'] = $user_email;
		$_SESSION['perfil'] = '?';
	} else {
		session_destroy();
		die('No access (invalid user)');
	}
} else if (!isset($_SESSION['usuario'])) {
	header('Location: login/');
	session_destroy();
	exit();
}
$content = (isset($_GET['content']) ? $_GET['content'] : '');
//echo 'content='.$content;

if (($_SESSION['usuario']=='admin') && (($content=='') || ($content=='Admin'))) {
	$_SESSION['perfil'] = 'admin';
	header('Location: admin/');
} else {
	if ($content=='') $content='Films';
	if ($content!='Admin') {
		header('Location: public/index.php?content='.$content);
	} else 
		die('No access (invalid user)');
}
?>